package com.zxx.ssm.controller;

import com.zxx.ssm.dao.Course;
import com.zxx.ssm.dao.CourseExample;
import com.zxx.ssm.model.result.BizResponse;
import com.zxx.ssm.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("course")
public class CourseController {

    @Autowired
    private CourseService courseService;

    @RequestMapping(value = "getAll", method = RequestMethod.GET)
    @ResponseBody
    public BizResponse getAllCourse() {
        BizResponse bizResponse = new BizResponse();
        CourseExample courseExample = new CourseExample();
        List<Course> courseList = courseService.selectByExample(courseExample);
        bizResponse.put("courseType", courseList);
        return bizResponse;
    }
}
